package com.lanyun.serviceimpl;

import com.lanyun.dao.ProcurementDao;
import com.lanyun.dao.SupplierDao;
import com.lanyun.pojo.Procurement;
import com.lanyun.pojo.Product;
import com.lanyun.pojo.Supplier;
import com.lanyun.service.ProcurementService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class ProcurementServiceImpl implements ProcurementService {

    @Autowired
    private ProcurementDao procurementDao;
    @Autowired
    private SupplierDao supplierDao;


    // 获取所有采购订单详情数据以及采购详情单
    @Override
    public List<Procurement> ShowProcurements(
    ) {
        System.out.println("===================");
        return procurementDao.ShowProcurements();
    }

    // 获取总采购订单总数据
    @Override
    public Integer Count() {
        return procurementDao.Count();
    }

    // 通过ID 查询对应的采购订单数据
    @Override
    public List<Procurement> GetProcurementByID(Integer id) {
        return procurementDao.GetProcurementByID(id);
    }

    // 获取已经存入的采购单数据
    @Override
    public List<Procurement> GetProcurementAll() {
        return procurementDao.GetProcurementAll();
    }

    // 存入申请采购清单的数据  有申请日期 和下单员 和 订单状态
    @Override
    public Integer AddProcurement(Procurement procurement) {
        return procurementDao.AddProcurement(procurement);
    }
    // 根据表单ID 获取到相关表单数据
    @Override
    public Procurement Getdata(String id) {
        return procurementDao.Getdata(id);
    }

    // 根据提交的审核 改变订单的状态
    @Override
    public Integer updataProcurement(String admin, Date date,String pcm_status,String id) {
        return procurementDao.updataProcurement(admin,date,pcm_status,id);
    }

    //  用于订单采购 获取到所有商家的相关信息
    @Override
    public List<Supplier> getsuppliers() {
        return supplierDao.getsuppliers();
    }

    // 采购订单已经进入已确认状态
    @Override
    public Integer UpdataStatus(String admin,Date date,String staus,String waybill,String id) {
        return procurementDao.UpdataStatus(admin,date,staus,waybill,id);
    }
    // 采购订单没有关联的采购详情表 给予删除
    @Override
    public Integer RemoveProcurementByID(String pid) {
        return procurementDao.RemoveProcurementByID(pid);
    }

    // 反审核状态
    @Override
    public Integer upStatus( String status, String id) {
        return procurementDao.upStatus(status,id);
    }

    // 修改采购单最后状态
    @Override
    public Integer UpdataEnd(String admin, Date date, String status, String id) {
        return procurementDao.UpdataEnd(admin,date,status,id);
    }

    // 下拉款查询
    @Override
    public List<Procurement> selectEnd(String id, String name) {
        return procurementDao.selectEnd(id,name);
    }

    // 判断下拉框查询的状态和供应商是否匹配
    @Override
    public List<Procurement> Getstatus(String id) {
        return procurementDao.Getstatus(id);
    }
}
